package com.yowasa.xiuxian.engine.travel.adventure;

import com.google.common.collect.Sets;
import com.yowasa.xiuxian.engine.travel.AdventureInterface;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.MapEnum;
import com.yowasa.xiuxian.entity.enums.RefreshType;
import com.yowasa.xiuxian.service.helper.ItemHelper;
import com.yowasa.xiuxian.service.helper.ResourceHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * 金陵大厨 一次刷新仅能被触发一次
 * 上架一个鲜香锅巴
 */
@Component
public class ZhiShiChengJIngADV implements AdventureInterface {


    @Autowired
    private ResourceHelper resourceHelper;
    @Autowired
    private ItemHelper itemHelper;

    @Override
    public Set<MapEnum> limitMaps() {
        //清泉镇
        return Sets.newHashSet(MapEnum.QING_QUAN_ZHEN);
    }

    public boolean limitCheck(UserBO user) {
        return resourceHelper.checkHaveResource(user.getGuildId(), this.getClass().getName(), RefreshType.LOCK_TIME);
    }

    @Override
    public String exec(UserBO user) {
        resourceHelper.lockResource(user.getGuildId(), this.getClass().getName(), 10 * 360);
        itemHelper.addItem(user, "织诗成锦秘籍", 1);
        String msg = "你路过了清泉镇很有名的许愿池，在池边许下了愿望，夜晚你梦见了泉水精灵出现在你的梦里，他突然开始攻击你，你拼命战斗险胜泉水精灵，醒来时浑身大汗，旁边有一本秘籍\n" +
                "获得了战技[织诗成锦]的秘籍";
        return msg;
    }

}
